//
// Created by fazhehy on 2024/3/24.
//

#ifndef SERVO_H
#define SERVO_H

#include "hy_common_inc.h"

#define SERVO_FREQUENCY_300HZ
#define SMALL

#ifdef SERVO_FREQUENCY_300HZ
#ifdef SMALL
    #define SERVO_MEDIAN        4550
    #define SERVO_MAX_DUTY      5200
    #define SERVO_MIN_DUTY      3900
    #define SERVO_LIMIT         650
#else
    #define SERVO_MEDIAN        4500
    #define SERVO_MAX_DUTY      5460
    #define SERVO_MIN_DUTY      3540
    #define SERVO_LIMIT         960
#endif
#else
    #define SERVO_MEDIAN        750
    #define SERVO_MAX_DUTY      910
    #define SERVO_MIN_DUTY      580
    #define SERVO_LIMIT         150
#endif

void servo_init();
void servo_set_duty(int16_t duty);
double servo_input_angle(double Azimuth, float Heading);

#endif //SERVO_H
